import request from '@/utils/request';
import { getPageSize } from '@/utils/common';
import { async } from 'q';
/**
 * 查询司机证件列表
 */
export async function selectDriverPaperList(params) {
  params.pageSize = params.pageSize || getPageSize();
  return request(`/server/api/tms/tms-papers/selectTmsPapersList`, {
    method: 'POST',
    body: params,
  });
}

/**
 * 查询司机证件详情
 */
export async function selectDriverPaperDetail(params) {
  return request(`/server/api/tms/tms-papers/viewTmsPapersDetails`, {
    method: 'POST',
    body: params,
  });
}

/**
 *  保存或者保存并提交  /tms/tms-papers/updateTmsPapers
 */
export async function saveDriverPaper(params) {
  const { id, ...rest } = params;
  const url = id ? 'updateTmsPapers' : 'insertTmsPapers';
  return request(
    `/server/api/tms/tms-papers/${url}`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}

//删除证件
export async function delPapers(params) {
  return request(`/server/api/tms/tms-papers/deleteTmsPapers`, {
    method: 'POST',
    body: params,
  });
}

/**
 * 生成账单
 */
export async function generatedBills(params) {
  return request(`/server/api/tms/tms-papers/generateBill`, {
    method: 'POST',
    body: params,
  });
}

/**
 * 查询附件
 */
export async function selectFileList(params) {
  return request(`/server/api/tms/attachment/selectFileList`, {
    method: 'POST',
    body: params,
  });
}

export async function selectAll(params) {
  return request(`/server/api/tms/tms-papers/generateBillByCheckAll`, {
    method: 'POST',
    body: params,
  });
}
